Relax checks for error messages
authorAlex Crichton <alex@alexcrichton.com>
Tue, 13 Jan 2015 16:53:55 +0000 (08:53 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 13 Jan 2015 16:53:55 +0000 (08:53 -0800)
Looks like these got tweaked from the compiler...

Closes #1159

src/cargo/ops/cargo_rustc/context.rs

index a76de7fece296fac3c05bddd7dea4dbbe40bf678..8ddf900d695b2a0604e6604688cf897a1c8cccc7 100644 (file)
@@ -3,6 +3,8 @@ use std::collections::hash_map::Entry::{Occupied, Vacant};
 use std::str;
 use std::sync::Arc;
 
+use regex::Regex;
+
 use core::{SourceMap, Package, PackageId, PackageSet, Resolve, Target};
 use util::{self, CargoResult, ChainError, internal, Config, profile};
 use util::human;
@@ -98,7 +100,9 @@ impl<'a, 'b: 'a> Context<'a, 'b> {
         let error = str::from_utf8(output.error.as_slice()).unwrap();
         let output = str::from_utf8(output.output.as_slice()).unwrap();
         let mut lines = output.lines();
-        let dylib = if error.contains("dropping unsupported crate type `dylib`") {
+        let nodylib = Regex::new("unsupported crate type.*dylib").unwrap();
+        let nobin = Regex::new("unsupported crate type.*bin").unwrap();
+        let dylib = if nodylib.is_match(error) {
             None
         } else {
             let dylib_parts: Vec<&str> = lines.next().unwrap().trim()
@@ -108,7 +112,7 @@ impl<'a, 'b: 'a> Context<'a, 'b> {
             Some((dylib_parts[0].to_string(), dylib_parts[1].to_string()))
         };
 
-        let exe_suffix = if error.contains("dropping unsupported crate type `bin`") {
+        let exe_suffix = if nobin.is_match(error) {
             String::new()
         } else {
             lines.next().unwrap().trim()